Societies - both animal and human - are composed of many individuals interacting in complex ways. In humans, complex interplays between individual genotypes and social histories can critically affect social structure and socially-important outcomes. However, in free-living organisms such as humans, directly disentangling the effects of multiple genotypes, social histories, and feedback among these processes for every interacting individual can be bewildering. In this project we propose to use the fruit fly Drosophila melanogaster to directly test the complex interactions between genotype, social history, and social decision-making and to determine how these interactions scale up to predict emergent properties of resulting societies. Specifically, we will study the contributions of genetic variation, versus individual organismal plasticity, in response to an uncertain environment. Social behavior is fundamentally Bayesian, being an iterative process in which genetically encoded priors are updated based on individual experience - resulting in genotype- and experience-dependent behaviors. Plasticity is critical because it plays a fundamental role in the structure and function of societies - which emerge from interconnected groups of interacting individuals. We will investigate such issues as the mechanisms by which group-level traits such as the frequency of aggressive encounters emerge when individual behaviors and group composition are constantly in flux. Can we predict which groups, more genetically varying or more plastic, will exhibit most aggression? And, when plasticity operates, can societies ever reach a stable equilibrium? We will do this using an agent-based model of fly behavior, incorporating specific terms for response to experience, and effect of experience on behavioral traits. We will then use this model to make specific predictions about the groups that emerge when many individuals interact simultaneously. The models we exploit here are designed to be as realistic as possible. As such they are intractable to traditional analysis methods. Instead we will employ a relatively novel analysis method approximate Bayesian computation [ABC] that remains tractable in such a context. However, ABC methods impose extreme computational burdens. For that reason we will develop software that allows execution of these methods in parallel processing environments, and particularly on graphical processing units, with the potential to cheaply improve run-times by orders of magnitude. This software will be applicable to high-dimensional data of any sort for which ABC methods are appropriate, and not just behavioral models.